#include<stdio.h>
#include<string.h>
void upsidedown_str(char *);
int main()
{
    char c = '\0';
    int n = 0;
    scanf("%c %d", &c, &n);
    getchar();
    char word[110][110] = {0};
    int i = 0;
    for (i = 0; i < n; i++)
    {
        int j = 0;
        while ((word[i][j] = getchar()) != '\n')
        {
            if (word[i][j] != ' ')
            {
                word[i][j] = c;
            }
            j++;
        }
    }
    int flag = 1;
    for (i = 0; i < n / 2; i++)
    {
        if (strcmp(word[i], word[n - i - 1]) != 0)
        {
            flag = 0;
            break;
        }
    }
    if(flag)
    {
        printf("bu yong dao le\n");
    }
    //需要倒过来打印
    //倒序字符串
    for (i = 0; i < n; i++)
    {
        upsidedown_str(word[i]);
    }
    for (i = n-1; i >= 0; i--)
    {
        printf("%s", word[i]);
    }
    return 0;
}
void upsidedown_str(char* start)
{
    int len = strlen(start);
    char *end = start + len - 2;//不要'\n'
    char tmp;
    while (start < end)
    {
        tmp = *start;
        *start = *end;
        *end = tmp;
        start++;
        end--;
    }
}
